import { defineStore } from 'pinia'

export const useBoxStore = defineStore('box', {
    state: () => {
        return {
            alert_content: {
                type: 'success',
                title: '',
                text: '',
                is_show: false
            }
        }
    },
    actions: {
        alert(type, title, text) {
            // set value
            this.alert_content.type = type
            this.alert_content.title = title
            this.alert_content.text = text
            // alert
            this.alert_content.is_show = true
            // hide time
            setTimeout(() => {
                this.alert_content.is_show = false
            }, 2000)
        }
    }
})
